home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!als-il2-12
- From: stefmit@ix.netcom.com
- Newsgroups: comp.lang.c++
- Subject: [Q] Recursive mechanism
- Date: 11 Apr 1996 03:26:52 GMT
- Organization: Netcom
- Message-ID: <4khu5s$oop@dfw-ixnews1.ix.netcom.com>
- NNTP-Posting-Host: als-il2-12.ix.netcom.com
- X-NETCOM-Date: Wed Apr 10 10:26:52 PM CDT 1996
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- Could anybody explain the mechanism behind the following (broken) code:
- in a linked list:
- void List<type> :: reverse (Node<type> *p) const
- { while ( p!= 0)
- reverse (p -> next);
- cout << p -> data; }
- that is, replacing if with while to get an infinite loop?
- How does it differ in the way of processing from the correct usage of if?
- NOTE: the first call is made with reverse(first_element_pointer)
- Thanks.
-